Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  What will be the output of the given program?... Start Learning for Free
What will be the output of the given program?
#include<stdio.h>
void main()
{
      int value=0;
      if(value)
            printf("well done ");
      printf("Edurev");
}
  • a)
    well done Edurev
  • b)
    Edurev
  • c)
     
    complier error
  • d)
    None of these
Correct answer is option 'B'. Can you explain this answer?
Most Upvoted Answer
What will be the output of the given program?#include<stdio.h>vo...
As the value of variable value is zero so, it evaluates to false in the if condition.
Free Test
Community Answer
What will be the output of the given program?#include<stdio.h>vo...
Understanding the Program
The provided C program evaluates the variable `value` and prints output based on its condition.
Code Breakdown
- The program initializes an integer variable `value` to `0`.
- It uses an `if` statement to check if `value` is non-zero.
Condition Evaluation
- In C, a condition evaluates to `true` if the value is non-zero and `false` if it is zero.
- Since `value` is initialized to `0`, the condition `if(value)` evaluates to `false`.
Output Explanation
- The line `printf("well done ");` inside the `if` block will not execute because the condition is not met.
- The next line, `printf("Edurev");`, will execute regardless of the `if` condition, as it is outside the block.
Final Output
- Therefore, the only output of the program will be:
Edurev
Conclusion
- The correct answer is option 'B': Edurev.
This output is a direct result of the condition failing due to the initialization of `value` to `0`.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

What will be the output of the given program?#include<stdio.h>void main(){ int value=0; if(value) printf("well done "); printf("Edurev");}a)well done Edurevb)Edurevc)complier errord)None of theseCorrect answer is option 'B'. Can you explain this answer?
Question Description
What will be the output of the given program?#include<stdio.h>void main(){ int value=0; if(value) printf("well done "); printf("Edurev");}a)well done Edurevb)Edurevc)complier errord)None of theseCorrect answer is option 'B'. Can you explain this answer? for Computer Science Engineering (CSE) 2025 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about What will be the output of the given program?#include<stdio.h>void main(){ int value=0; if(value) printf("well done "); printf("Edurev");}a)well done Edurevb)Edurevc)complier errord)None of theseCorrect answer is option 'B'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2025 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for What will be the output of the given program?#include<stdio.h>void main(){ int value=0; if(value) printf("well done "); printf("Edurev");}a)well done Edurevb)Edurevc)complier errord)None of theseCorrect answer is option 'B'. Can you explain this answer?.
Solutions for What will be the output of the given program?#include<stdio.h>void main(){ int value=0; if(value) printf("well done "); printf("Edurev");}a)well done Edurevb)Edurevc)complier errord)None of theseCorrect answer is option 'B'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of What will be the output of the given program?#include<stdio.h>void main(){ int value=0; if(value) printf("well done "); printf("Edurev");}a)well done Edurevb)Edurevc)complier errord)None of theseCorrect answer is option 'B'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of What will be the output of the given program?#include<stdio.h>void main(){ int value=0; if(value) printf("well done "); printf("Edurev");}a)well done Edurevb)Edurevc)complier errord)None of theseCorrect answer is option 'B'. Can you explain this answer?, a detailed solution for What will be the output of the given program?#include<stdio.h>void main(){ int value=0; if(value) printf("well done "); printf("Edurev");}a)well done Edurevb)Edurevc)complier errord)None of theseCorrect answer is option 'B'. Can you explain this answer? has been provided alongside types of What will be the output of the given program?#include<stdio.h>void main(){ int value=0; if(value) printf("well done "); printf("Edurev");}a)well done Edurevb)Edurevc)complier errord)None of theseCorrect answer is option 'B'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice What will be the output of the given program?#include<stdio.h>void main(){ int value=0; if(value) printf("well done "); printf("Edurev");}a)well done Edurevb)Edurevc)complier errord)None of theseCorrect answer is option 'B'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev